home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 March / Ahoy_Magazine_86-03_1986_Double_L.d64 / speedy bug 2 (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1986-01-01  |  431 b   |  12 lines

  1. 1 rem  problem #23-3 :
  2. 2 rem    speedy bug
  3. 3 rem  solution by david hoffner
  4. 4 rem
  5. 10 sa=62.5:sb=37.5:d=800:input"[147]speed of bug";sf:ifsf<63then10
  6. 20 print"no. of    --position of---    miles
  7. 30 [153]" hours    train a  train b    flown
  8. 40 a=sb:gosub50:a=sa:gosub50:goto40
  9. 50 t=d/(sf+a):tt=tt+t:h=.01+(int(tt*100)/100):d=d-t*(sa+sb):ifd<.01thenend
  10. 60 pa=tt*62.5:pb=800-tt*37.5:pf=-pb*(a=sb)-pa*(a=sa):mf=mf+abs(pf-sp):sp=pf
  11. 70 printh,int(pa+.5),int(pb+.5),int(mf+.5):return
  12.